<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class MaterialSpecification extends BaseModel
{
    use HasFactory;
    protected $table = 'material_specification';
    // 允许批量操作的字段
    protected $fillable = ['name','is_del','created_at','updated_at'];

    public function scopeSearch($query,$params)
    {
        if(!empty($params['name'])){
            $query->where('name','like','%'.$params['name'].'%');
        }
        $query->where('is_del',$params['is_del']??2);
        return $query;
    }
}
